<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>首页</title>
    <link th:href="@{/layui/css/layui.css}" rel="stylesheet"/>
    <link th:href="@{/css/index.css}" rel="stylesheet"/>
    <link th:href="@{/css/tool.css}" rel="stylesheet"/>
    <script th:src="@{/layui/layui.js}"></script>
</head>
<style>
    .layui-table-view{
        margin: 0 0;
    }
</style>
<body>
<div th:insert="~{navigation::nav}"></div>
<div class="layui-fluid main1">
    <div class="layui-row layui-col-space10">
        <div class="layui-col-lg9">
            <h1>招标专区</h1>
            <hr>
            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
                <ul class="layui-tab-title">
                    <li class="layui-this">招标（预审）公告</li>
                    <li>已开标</li>
                    <li>变更公告</li>
<!--                    <li>中标候选人公示</li>-->
                </ul>
                <div class="layui-tab-content" style="height: 100px;">
                    <div class="layui-tab-item layui-show">
                        <table id="weiKaiBiao" lay-filter="test1"></table>
                    </div>
                    <div class="layui-tab-item">
                        <table id="zhongbiao" lay-filter="test"></table>
                    </div>
                    <div class="layui-tab-item">
                        <table id="modify" lay-filter="test2"></table>
                    </div>
                    <div class="layui-tab-item">
                        <table id="zhongbiaohouxuan" lay-filter="test2"></table>
                    </div>
                </div>
            </div>
        </div>
        <div class="layui-col-lg3">
            <h1>系统公告</h1>
            <hr>
            <ul class="ul1">
                <li><a href="">本电子招投标平台操作指南</a></li>
                <li><a href="">系统公告系统公告系统公告系统公告系统公告1</a></li>
                <li><a href="">系统公告系统公告系统公告系统公告系统公告2</a></li>
                <li><a href="">系统公告系统公告系统公告系统公告系统公告3</a></li>
                <li><a href="">系统公告系统公告系统公告系统公告系统公告4</a></li>
                <li><a href="">系统公告系统公告系统公告系统公告系统公告5</a></li>
                <li><a href="">系统公告系统公告系统公告系统公告系统公告6</a></li>
            </ul>

<!--            <div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">-->
<!--                <ul class="layui-tab-title">-->
<!--                    <li class="layui-this">中标结果</li>-->
<!--                    <li>用户管理</li>-->
<!--                    <li>权限分配</li>-->
<!--                </ul>-->
<!--                <div class="layui-tab-content" style="height: 100px;">-->
<!--                    <div class="layui-tab-item layui-show">-->
<!--                        <table id="zhongbiao" lay-filter="test"></table>-->
<!--                    </div>-->
<!--                    <div class="layui-tab-item">内容2</div>-->
<!--                    <div class="layui-tab-item">内容3</div>-->
<!--                </div>-->
<!--            </div>-->
        </div>
    </div>
</div>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="Details">查看</a>
    <!--    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>-->
</script>
<script type="text/html" id="shStatus">
    {{#  if(d.publishInfo.publishShFlag == 1){ }}
    <div class="tbStatus2">
        已开标
    </div>
    {{#  } }}

</script>
<script type="text/html" id="kbStatus">
    {{#  if(d.kbFlag == 1){ }}
    <div class="tbStatus2">
        已开标
    </div>
    {{#  }else if(d.kbFlag == 0){ }}
    <div class="tbStatus1">
        报名中
    </div>
    {{#  } }}

    <div class="shIcon">
        报名中
    </div>
</script>
</body>
<script>
    //注意：导航 依赖 element 模块，否则无法进行功能性操作
    layui.use(['table', 'util', 'layer','element'], function () {
        var table = layui.table,
            $ = layui.$,
            util = layui.util,
            layer = layui.layer,
            element = layui.element;

        table.render({
            elem: '#zhongbiao'
            , height: 312
            , url: '/admin/publishData' //数据接口
            //, page: true //开启分页
            , cols: [
                [ //表头
                    {field: 'd.zbInfo.title', title: '招标项目名称',align:'center', templet: "<div>{{d.zbInfo.title}}</div>"}
                    ,{field: 'd.tbInfo.projectId', title: '中标项目编号',align:'center', templet: "<div>{{d.tbInfo.projectId}}</div>"}
                    ,{field: 'd.zbInfo.type', title: '项目类型', align:'center',templet: "<div>{{d.zbInfo.type}}</div>"}
                    ,{field: 'd.zbInfo.openTime', title: '开标时间', align:'center',templet: function(d){
                        return util.toDateString(d.zbInfo.openTime,'yyyy-MM-dd HH:mm:ss');}}
                    , {field: 'd.publishInfo.publishShFlag', align:'center',title: '状态', width: 125, templet: '#shStatus'},
                    , { align:'center',title: '操作', width: 65, toolbar: '#barDemo'}
                ]
            ],
            skin : 'nob'
        });

        table.on("tool(test)",function (obj) {
            var data = obj.data;

            if(obj.event === 'Details'){
                location.href='/zb_result/'+data.publishInfo.id;
            }
        })


        table.render({
            elem: '#weiKaiBiao'
            , height: 312
            , url: '/weiKaiBiao' //数据接口
            //, page: true //开启分页
            , cols: [
                [ //表头
                    {field: 'title', title: '招标项目', align:'center',width:'35%'}
                    ,
                    {field: 'type', title: '招标类型', align:'center'}
                    , {field: 'projectEndTime', align:'center', title: '投标截止时间',  templet: function(d){
                        return util.toDateString(d.projectEndTime,'yyyy-MM-dd HH:mm:ss');}}
                    , {field: 'kbFlag', title: '状态', align:'center', templet: '#kbStatus'},

                    , {align:'center',title: '操作', width:65,toolbar: '#barDemo'}
                ]
            ],
            skin : 'nob',
            where:{
              kbFlag : 0
            }
        });

        table.on('tool(test1)',function (obj) {
            var data = obj.data;
            if(obj.event==='Details'){
                location.href='/show/'+data.id;
            }
        })

        table.render({
            elem: '#modify'
            , height: 312
            , url: '/getZbModifyData' //数据接口
            //, page: true //开启分页
            , cols: [
                [ //表头
                    {field: 'd.zbInfo.projectId', align:'center', title: '招标编号',templet:"<div>{{d.zbInfo.projectId}}</div>"}
                    ,
                    {field: 'd.zbInfo.title', align:'center', title: '招标项目名称',width:'35%',templet:"<div>{{d.zbInfo.title}}</div>"}
                    ,
                    {title : '公告变更',align:'center',templet:"<div>公告变更</div>"}
                    ,
                    {field: 'd.zbInfo.type',align:'center', title: '项目类型',templet:"<div>{{d.zbInfo.type}}</div>"}
                    ,
                    {align:'center',title: '操作', width:69,toolbar: '#barDemo'}
                ]
            ],
            skin:'nob',
            done:function (res) {
                console.log(res.data)
            }
        });

        table.on('tool(test2)',function (obj) {
            var data = obj.data;
            if(obj.event==='Details'){
                location.href='/showModify/'+data.zbModify.zbId;
            }
        })

        table.render({
            elem: '#zhongbiaohouxuan'
            , height: 312
            , url: '/getZbModifyData' //数据接口
            //, page: true //开启分页
            , cols: [
                [ //表头
                    {field: 'd.zbInfo.projectId', align:'center', title: '招标编号',templet:"<div>{{d.zbInfo.projectId}}</div>"}
                    ,
                    {field: 'd.zbInfo.title', align:'center', title: '招标项目名称',width:'35%',templet:"<div>{{d.zbInfo.title}}</div>"}
                    ,
                    {title : '公告变更',align:'center',templet:"<div>公告变更</div>"}
                    ,
                    {field: 'd.zbInfo.type',align:'center', title: '项目类型',templet:"<div>{{d.zbInfo.type}}</div>"}
                    ,
                    {align:'center',title: '操作', width:69,toolbar: '#barDemo'}
                ]
            ],
            skin:'nob'
        });
    });
</script>
</html>